<?php

namespace Wilead\IArtistBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class JobType extends AbstractType {

    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options) {
        $data = $builder->getData();

        $builder
                ->add('title')
                ->add('description')
                ->add('demand')
                ->add('cat')
                ->add('pay')
                ->add('deadline')
                ->add('skills')
        ;
        if ($data->getId() == NULL)
            $builder->add('User');
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'Wilead\IArtistBundle\Entity\Job'
        ));
    }

    /**
     * @return string
     */
    public function getName() {
        return '';
    }

}
